<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js 解释器</title>
</head>
<body>
    
</body>
<script >
function log(name) {
  return function decorator(t, n, descriptor) {
    const original = descriptor.value;
    if (typeof original === 'function') {
      descriptor.value = function (...args) {
        console.log("Logged at:", new Date().toLocaleString());
        try {
          const result = original.apply(this, args);
          console.log(`Result from ${name}: ${result}`);
          return result;
        } catch (e) {
          console.log(`Error from $ {name}: ${e}`);
          throw e;
        }
      };
    }
    return descriptor;
  };
}

class Calculator {
  @log('Multiply')
    multiply(x,y){
      return x*y;
  }
}    

calculator = new Calculator();
calculator.multiply(10,10);

</script>
</html>